import java.util.Scanner;

/**
 * Version: 1.1
 * Author: TangJun
 * Date: 2024-07-21
 */
public class Main {
    public static void main1(String[] args) {
        Scanner scan = new Scanner(System.in);
        String s;
        while (scan.hasNext()) {
            char[] chars = new char[255-65];
            s = scan.next();
            for (int i = 0; i < s.length(); i++) {
                if (chars[s.charAt(i) - 'A'] == 0) {
                    chars[s.charAt(i) - 'A']++;
                    System.out.print(s.charAt(i) + " ");
                }
            }
            System.out.println();
        }
    }

    public static void solution(int[] a, int ak, int[] b) {
        int m = ak - 1;
        int n = b.length - 1;
        int k = a.length - 1;
        while (m >= 0 && n >= 0) {
            //(a[m] > b[n]) ? (a[k--] = a[m--]) : (a[k--] = b[n--]);
            if (a[m] > b[n]) {
                a[k--] = a[m--];
            }else {
                a[k--] = b[n--];
            }
        }
    }
    public static void main(String[] args) {
        int[] arr1 = new int[10];
        arr1[0] = 1;
        arr1[1] = 3;
        arr1[2] = 5;
        arr1[3] = 7;
        arr1[4] = 9;
        int[] arr2 = {2,4,6,8,10};
        solution(arr1, 5, arr2);
        for (int x : arr1) {
            System.out.print(x + " ");
        }

    }
}
